<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>舒尔特表</title>
    <!-- <link
      rel="stylesheet"
      type="text/css"
      href="../css/css3.css"
      charset="utf-8"
    /> -->
    <!-- <script src="../js/jquery-1.7.2.js"></script> -->
    <script type="text/javascript">
      $(document).ready(function () {
        //二维数组
        function getDiffGroup(num, min, max) {
          var res = []
          for (var i = min; i <= max; i++) {
            //从最小数开始 加一 到最大数
            res.push(i) //将所有的数 push到数组中
          }
          res.sort(function () {
            return 0.5 - Math.random() //随机数排序
          })
          var rst = []
          for (var i = 0; i < res.length; i += num) {
            rst.push(res.slice(i, i + num)) //数组中放入截取后的数组
          }
          return rst
        }
        var rst = getDiffGroup(5, 1, 25) //5*5二维数组
        console.log(rst.join('\n'))
        //将二维数组放入页面
        var div = document.getElementById('div1')
        //拼接table
        var str =
          "<table border='1' width='400' height='400' cellspacing='0' cellpadding='0' >"
        // 循环遍历二维数组
        for (var i = 0; i < rst.length; i++) {
          //循环最外面的数组
          str += '<tr>'
          for (var j = 0; j < rst[i].length; j++) {
            //循环里面的数组
            str += "<td align='center'>" + rst[i][j] + '</td>' //拼接<td>
          }
          str += '</tr>'
        }
        str += '</table>'
        //将table添加到div中
        div.innerHTML = str
      })
    </script>
  </head>
  <body>
    <div class="slide" id="div1" align="center"></div>
  </body>
</html>
